﻿using System;
using System.Collections.Generic;
using Microsoft.BusinessData.MetadataModel.Collections;

namespace BdcRestConnector.Tests
{
    public class MyProperties : INamedPropertyDictionary
    {
        private readonly Dictionary<string, object> _dict;

        public MyProperties(params KeyValuePair<string, object>[] properties)
        {
            _dict = new Dictionary<string, object>();
            foreach (var pair in properties)
            {
                _dict.Add(pair.Key, pair.Value);
            }
        }

        public bool ContainsKey(string key)
        {
            return _dict.ContainsKey(key);
        }

        public ICollection<string> Keys
        {
            get { return _dict.Keys; }
        }

        public bool TryGetValue(string key, out object value)
        {
            return _dict.TryGetValue(key, out value);
        }

        public ICollection<object> Values
        {
            get { return _dict.Values; }
        }

        public object this[string key]
        {
            get { return _dict[key]; }
        }

        public bool Contains(KeyValuePair<string, object> item)
        {
            throw new NotImplementedException();
        }

        public void CopyTo(KeyValuePair<string, object>[] array, int arrayIndex)
        {
            throw new NotImplementedException();
        }

        public int Count
        {
            get { throw new NotImplementedException(); }
        }

        public KeyValuePair<string, object> this[int index]
        {
            get { throw new NotImplementedException(); }
        }

        public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
        {
            return _dict.GetEnumerator();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return _dict.GetEnumerator();
        }
    }
}
